﻿Partial Public Class frm_BaseTest
    Inherits System.Web.UI.Page

    Public masterpage As FormBase

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim obr As New BR.Web.Utilitarios.Abms.test
        masterpage = CType(Page.Master, FormBase) 'instancia iniciada de la clase de masterpage

        masterpage.lblTitulo = "FormBase Test"
        masterpage.InicializarPagina(obr)
        mostrar()
    End Sub

    Private Sub grabaNombre()
        DA.Sql.Insert(ConnectionString, "usr_formbasetest", "nombre", "'" & txtNombre.Text & "'")
        mostrar()
    End Sub

    Private Sub mostrar()
        Dim ds As New DataSet
        ds = DA.Sql.Select(ConnectionString, "nombre", "usr_formbasetest", Nothing, "nombre ASC")
        DivNombres.Controls.Clear()
        For Each row In ds.Tables(0).Rows
            Dim divRow As New Literal
            divRow.Text = "<div>" & row(0) & "</div>"
            DivNombres.Controls.Add(divRow)
        Next
    End Sub

    Protected Sub enviar() Handles Button1.Click
        grabaNombre()
    End Sub

    Protected Overloads Sub OnPreInit() Handles Me.PreInit

        If Not Session("Tema") Is Nothing Then
            'Asignacion de tema
            Page.Theme = Session("Tema").ToString
        End If
    End Sub

End Class